******************************************************************
******************************************************************
*LONG RUN*********************************************************
******************************************************************
******************************************************************

*The code below produces the files to reproduce the long run estimates reported in the Online Appendix.
*The do-file reorganizes the synth output produced by datasets.do into a structure that makes it easier to do the long run analyses.
*Thus, you have to create the synth files before you can run this file, i.e. you need to run datasets.do (once) before you can run this do-file.

*CREATING HELP FILES AND ANALYSES FILES
*CHILDCARE
*Estimates

clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synth`t'_`i'.dta, clear
drop _Co_Number _W_Weight
drop if _time==.
gen pre = 1 if _time<1996
gen post = 1 if _time>1995
bys pre: gen nr = _n
by pre, sort: egen max = max(nr)
gen spe  = (_Y_treated - _Y_synthetic)^2
bys pre: egen sum_spe = sum(spe)
gen sum_spe_post = sum_spe/max
su sum_spe_post if pre == 1
gen premspe = r(mean)
su sum_spe_post if post == 1
gen postmspe = r(mean)
gen RMSPE = postmspe/premspe
gen komnr = `i'
gen model = `t'
save synth_out`t'_`i'.dta, replace
}
}
*p-values, rmspe og post-mspe
clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synth_out`t'_`i'.dta, clear
keep if _time==2011
keep premspe postmspe RMSPE   komnr model
save synthmspe`t'_`i'.dta, replace
}
}

clear
use synthmspe1_615.dta
foreach t of numlist 2 3 4 5 6 7 8 9 10{
append using synthmspe`t'_615.dta
}
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthmspe`t'_`i'.dta
}
}

 save "childcareoutput_long.dta", replace

 
*CREATING HELP FILES AND ANALYSES FILES
*EDUCATION
*Estimates

clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10 {
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synthed`t'_`i'.dta, clear
drop _Co_Number _W_Weight
drop if _time==.
gen pre = 1 if _time<1996
gen post = 1 if _time>1995 
bys pre: gen nr = _n
by pre, sort: egen max = max(nr)
gen spe  = (_Y_treated - _Y_synthetic)^2
bys pre: egen sum_spe = sum(spe)
gen sum_spe_post = sum_spe/max
su sum_spe_post if pre == 1
gen premspe = r(mean)
su sum_spe_post if post == 1
gen postmspe = r(mean)
gen RMSPE = postmspe/premspe
gen komnr = `i'
gen model = `t'
save synthed_out`t'_`i'.dta, replace
}
}

*p-values, rmspe og post-mspe
clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synthed_out`t'_`i'.dta, clear
keep if _time==2011
keep premspe postmspe RMSPE   komnr model
save synthedmspe`t'_`i'.dta, replace
}
}

clear
use synthedmspe1_615.dta
foreach t of numlist 2 3 4 5 6 7 8 9 10 {
append using synthedmspe`t'_615.dta
}
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthedmspe`t'_`i'.dta
}
}

 save "educationoutput_long.dta", replace
 
 
*CREATING HELP FILES AND ANALYSES FILES
*ELDERLYCARE
*Estimates

clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synthel`t'_`i'.dta, clear
drop _Co_Number _W_Weight
drop if _time==.
gen pre = 1 if _time<1996
gen post = 1 if _time>1995
bys pre: gen nr = _n
by pre, sort: egen max = max(nr)
gen spe  = (_Y_treated - _Y_synthetic)^2
bys pre: egen sum_spe = sum(spe)
gen sum_spe_post = sum_spe/max
su sum_spe_post if pre == 1
gen premspe = r(mean)
su sum_spe_post if post == 1
gen postmspe = r(mean)
gen RMSPE = postmspe/premspe
gen komnr = `i'
gen model = `t'
save synthel_out`t'_`i'.dta, replace
}
}

*p-values, rmspe og post-mspe
clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synthel_out`t'_`i'.dta, clear
keep if _time==2011
keep premspe postmspe RMSPE   komnr model
save synthelmspe`t'_`i'.dta, replace
}
}

clear
use synthelmspe1_615.dta
foreach t of numlist 2 3 4 5 6 7 8 9 10{
append using synthelmspe`t'_615.dta
}
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthelmspe`t'_`i'.dta
}
} 

 save "elderlyoutput_long.dta", replace
 
  
*CREATING HELP FILES AND ANALYSES FILES
*HEALTHCARE
*Estimates

clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synthhe`t'_`i'.dta, clear
drop _Co_Number _W_Weight
drop if _time==.
gen pre = 1 if _time<1996
gen post = 1 if _time>1995
bys pre: gen nr = _n
by pre, sort: egen max = max(nr)
gen spe  = (_Y_treated - _Y_synthetic)^2
bys pre: egen sum_spe = sum(spe)
gen sum_spe_post = sum_spe/max
su sum_spe_post if pre == 1
gen premspe = r(mean)
su sum_spe_post if post == 1
gen postmspe = r(mean)
gen RMSPE = postmspe/premspe
gen komnr = `i'
gen model = `t'
save synthhe_out`t'_`i'.dta, replace
}
}

*p-values, rmspe og post-mspe
clear
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 615 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
use synthhe_out`t'_`i'.dta, clear
keep if _time==2011
keep premspe postmspe RMSPE   komnr model
save synthhemspe`t'_`i'.dta, replace
}
}

clear
use synthhemspe1_615.dta
foreach t of numlist 2 3 4 5 6 7 8 9 10{
append using synthhemspe`t'_615.dta
}
foreach t of numlist 1 2 3 4 5 6 7 8 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthhemspe`t'_`i'.dta
}
}

 save "healthoutput_long.dta", replace
 



*LONG RUN MODEL AVERAGE INFERENCE P-VALUES
*childcare
clear
use synthmspe1_615.dta
foreach t of numlist   2 3 4 9 10{
append using synthmspe`t'_615.dta
}
foreach t of numlist   2 3 4 5 6{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthmspe`t'_`i'.dta
}
}

save "childcare_avg_p_long.dta", replace


*education
clear
use synthedmspe1_615.dta, clear
foreach t of numlist 2 3 4 9 10{
append using synthedmspe`t'_615.dta
}
foreach t of numlist 2 3 4 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthedmspe`t'_`i'.dta
}
}

save "education_avg_p_long.dta", replace

*elderlycare
*p-value
clear
use synthelmspe1_615.dta, clear
foreach t of numlist 2 7 8  9 10{
append using synthelmspe`t'_615.dta
}
foreach t of numlist 2 3 4 9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthelmspe`t'_`i'.dta
}
}

save "elderly_avg_p_long.dta", replace


*health care
*p-value
clear
use synthhemspe1_615.dta
foreach t of numlist 2 3  5 6 7 8  9 10{
append using synthhemspe`t'_615.dta
}
foreach t of numlist 2 3  5 6 7 8  9 10{
foreach i of numlist 121 428 430 432 434 437 438 439 511 512 513 514 515 517 540 541 542 543 544 545 616 617 618 619 620 621 633 821 826 828 829 830 831 833 834 929 938 940 941 1003 1026 1034 1046 1133 1134 1135 1144 1151 1211 1223 1224 1227 1233 1234 1238 1244 1252 1264 1265 1266 1411 1412 1413 1416 1418 1420 1421 1424 1426 1438 1439 1441 1515 1524 1525 1539 1545 1546 1560 1563 1566 1567 1573 1612 1617 1620 1621 1627 1630 1632 1633 1634 1635 1640 1644 1665 1711 1717 1718 1736 1738 1739 1740 1742 1743 1748 1749 1750 1751 1755 1811 1815 1816 1818 1825 1826 1827 1828 1834  1835 1836 1837 1838 1839 1848 1849 1850 1851 1853 1854 1856 1857 1860 1866 1867 1868 1870 1871 1917 1919 1922 1924 1925 1926 1927 1929 1931 1933 1939 1943 2002 2011 2015 2017 2020 2021 2022 2023 2024 2025 2027 2028 2030   {
append using synthhemspe`t'_`i'.dta
}
}

save "health_avg_p_long.dta", replace
